package org.onvivals.module.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.onvivals.common.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;

/**
 * 角色表
 */
@Schema(description="角色表")
@Data
@TableName(value = "sys_role")
public class SysRole extends BaseEntity<SysRole> {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "role_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using= ToStringSerializer.class)
    @Schema(description="ID")
    private Long roleId;

    /**
     * 名称
     */
    @TableField(value = "`name`")
    @Schema(description="名称")
    private String name;

    /**
     * 角色标识
     */
    @TableField(value = "role_code")
    @Schema(description="角色标识")
    private String roleCode;

    /**
     * 描述
     */
    @TableField(value = "description")
    @Schema(description="描述")
    private String description;

    /**
     * 数据权限
     */
    @TableField(value = "data_scope")
    @Schema(description="数据权限")
    private String dataScope;

    /**
     * 用户ID
     */
    @Schema(hidden = true)
    @JsonSerialize(using= ToStringSerializer.class)
    @TableField(exist = false)
    private Long userId;

}
